package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.market.ArriveTime;
import com.wzutils.TimeUtils;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/6/15 --15:24.
 * @Email 87683202@qq.com
 */
public class ArriveTimeAdapter extends BaseQuickAdapter<ArriveTime, BaseViewHolder> {
    boolean isCanDo;
    public ArriveTimeAdapter(@LayoutRes int layoutResId, @Nullable List<ArriveTime> data, boolean isCanDo) {
        super(layoutResId, data);
        this.isCanDo=isCanDo;
    }

    @Override
    protected void convert(BaseViewHolder helper, ArriveTime item) {
        helper
                .addOnClickListener(R.id.item_edit)
                .setVisible(R.id.item_edit,isCanDo);
        if (item.getArriveTime() != null)
            helper.setText(R.id.item_time, TimeUtils.dateToString(item.getArriveTime(), TimeUtils.HOUR_MIN) + " ± " + item.getOffset() + "分钟");
    }
}
